$(document).ready(function() {

	$('#btn_publish').on('click', function() {
		
		alert("xxxxxxxxxxxxxxxxxxx");
//		var data = {};
//		$('#frm_publish input[name]').each(function() {
//			data[this.getAttribute('name')] = this.value;
//			alert(this.value);
//		});
		/**
		$.ajax({
			url : '/logon',
			type : 'post',
			contentType : 'application/json;charset=utf-8',
			data : JSON.stringify(data),
			timeout : 5000,
			dataType : 'json',
			success : function(data, textStatus) {
				
				if(data.code == 1){
					
					//window.location.href="/index.html";
				}else{
					//$("#login_message b").empty();
					//$('#login_message b').append(data.message);
				}

			},
			error : function(xhr, textStatus) {
				console.log(xhr)
				console.log(textStatus)
			}
		})
		**/
	});	
	
	//加载省份
	$.ajax({
		url : '/vod/findArea',
		type : 'get',
		contentType : 'application/json;charset=utf-8',
		data : {},
		timeout : 5000,
		dataType : 'json',
		success : function(data, textStatus) {
			
			if(data.resultCode == 1){	    

			    $.each(data.result, function (index, item) {

			    	$("#comb_province").append("<option value='" + item.id + "'>" + item.name + "</option>");
			        
			    });
			    
			    $('#comb_province').trigger("change");
			}
		},
		error : function(xhr, textStatus) {
			console.log(xhr)
			console.log(textStatus)
		}
	});
	
	
	$('#comb_province').on('change', function() {

		var province = $("#comb_province").find('option:selected').val();
		
		$.ajax({
			url : '/vod/findCity?province=' + province,
			type : 'get',
			contentType : 'application/json;charset=utf-8',
			data : {},
			timeout : 5000,
			dataType : 'json',
			success : function(data, textStatus) {
				
				$("#comb_city option").remove();
				
				if(data.resultCode == 1){	    

				    $.each(data.result, function (index, item) {

				    	$("#comb_city").append("<option value='" + item.id + "'>" + item.name + "</option>");

				    });
				    
				    $('#comb_city').trigger("change");
				}
			},
			error : function(xhr, textStatus) {
				console.log(xhr)
				console.log(textStatus)
			}
		});
	});
	
	
	$('#comb_city').on('change', function() {

		var city = $("#comb_city").find('option:selected').val();
		
		$.ajax({
			url : '/vod/findKaochang?city=' + city,
			type : 'get',
			contentType : 'application/json;charset=utf-8',
			data : {},
			timeout : 5000,
			dataType : 'json',
			success : function(data, textStatus) {
				
				$("#comb_kaochang option").remove();
				
				if(data.resultCode == 1){	    

				    $.each(data.result, function (index, item) {

				    	$("#comb_kaochang").append("<option value='" + item.id + "'>" + item.name + "</option>");

				    });
				}
			},
			error : function(xhr, textStatus) {
				console.log(xhr)
				console.log(textStatus)
			}
		});
	});	
	
	
	
	
});